package com.zhangsr.zus.rpc.api;

/**
 * @Author: zhangsr
 */
public class RpcResult implements Result {

    private Object result;

    private Throwable exception;

    public RpcResult() {
    }

    public RpcResult(Object result) {
        this.result = result;
    }

    public RpcResult(Throwable exception){
        this.exception = exception;
    }

    public Object recreate() throws Throwable {
        if (exception != null) {
            throw exception;
        }
        return result;
    }
}
